package normalclass;
/*
* 方法中返回的引用变量，本质上是返回变量中存储的对象的地址值
* 方法中返回匿名对象，依然是返回对象地址值
* */
public class Demo02 {
    public static void main(String[] args) {
        Worker worker = method01();
        System.out.println(worker.name);

        Person person = method02();
        System.out.println(person.name);

        Worker worker02 = method03(worker);
        System.out.println(worker.name);
    }

    public static Worker method01(){
        Worker w = new Worker();
        w.name = "老王";
        return w;
    }

    public static Person method02(){
        return new Worker();
    }

    public static Worker method03(Worker w){
        w.name = "小红";
        return w;
    }
}
